package p270jp.pxv.android.viewholder;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import java.util.Objects;
import p014ae.View$OnClickListenerC0151s;
import p047bg.C1124a;
import p165fo.C3114c;
import p216hn.DefaultConstructorMarker;
import p270jp.pxv.android.R;
import p270jp.pxv.android.event.SelectGiftingItemEvent;
import p270jp.pxv.android.model.pixiv_sketch.SketchLiveGiftingItem;
import p314lg.ViewHolderLiveGiftBinding;
import p325m0.MutabilityOwnership;
import p652yj.C7346b;

/* compiled from: LiveGiftingItemViewHolder.kt */
/* renamed from: jp.pxv.android.viewholder.LiveGiftingItemViewHolder */
/* loaded from: classes2.dex */
public final class LiveGiftingItemViewHolder extends RecyclerView.AbstractC0819y {
    private final ViewHolderLiveGiftBinding binding;
    public static final Companion Companion = new Companion(null);
    public static final int $stable = 8;

    /* compiled from: LiveGiftingItemViewHolder.kt */
    /* renamed from: jp.pxv.android.viewholder.LiveGiftingItemViewHolder$Companion */
    /* loaded from: classes2.dex */
    public static final class Companion {
        private Companion() {
        }

        public /* synthetic */ Companion(DefaultConstructorMarker eVar) {
            this();
        }

        public final LiveGiftingItemViewHolder createViewHolder(ViewGroup viewGroup) {
            ViewHolderLiveGiftBinding w6Var = (ViewHolderLiveGiftBinding) C7346b.m327a(viewGroup, "parent", R.layout.view_holder_live_gift, viewGroup, false);
            MutabilityOwnership.m3746l(w6Var, "binding");
            return new LiveGiftingItemViewHolder(w6Var, null);
        }
    }

    private LiveGiftingItemViewHolder(ViewHolderLiveGiftBinding w6Var) {
        super(w6Var.f2666e);
        this.binding = w6Var;
    }

    public /* synthetic */ LiveGiftingItemViewHolder(ViewHolderLiveGiftBinding w6Var, DefaultConstructorMarker eVar) {
        this(w6Var);
    }

    /* renamed from: a */
    public static /* synthetic */ void m4423a(SketchLiveGiftingItem sketchLiveGiftingItem, View view) {
        m12324onBindViewHolder$lambda0(sketchLiveGiftingItem, view);
    }

    /* renamed from: onBindViewHolder$lambda-0 */
    public static final void m12324onBindViewHolder$lambda0(SketchLiveGiftingItem sketchLiveGiftingItem, View view) {
        MutabilityOwnership.m3745m(sketchLiveGiftingItem, "$giftingItem");
        C3114c.m6284b().m6280f(new SelectGiftingItemEvent(sketchLiveGiftingItem));
    }

    public final void onBindViewHolder(SketchLiveGiftingItem sketchLiveGiftingItem) {
        MutabilityOwnership.m3745m(sketchLiveGiftingItem, "giftingItem");
        Context context = this.itemView.getContext();
        MutabilityOwnership.m3746l(context, "itemView.context");
        String str = sketchLiveGiftingItem.image.svg.url;
        ImageView imageView = this.binding.f22396q;
        MutabilityOwnership.m3746l(imageView, "binding.giftingItemImageView");
        C1124a.m10195S(context, str, imageView);
        this.binding.f22396q.setOnClickListener(new View$OnClickListenerC0151s(sketchLiveGiftingItem, 25));
    }

    public final void onRecycleViewHolder() {
        Context context = this.itemView.getContext();
        MutabilityOwnership.m3746l(context, "itemView.context");
        ImageView imageView = this.binding.f22396q;
        MutabilityOwnership.m3746l(imageView, "binding.giftingItemImageView");
        boolean z = true;
        if (context instanceof Activity) {
            z = true ^ ((Activity) context).isDestroyed();
        }
        if (z) {
            RequestManager e = Glide.m9615e(context);
            Objects.requireNonNull(e);
            e.m9606l(new RequestManager.C1259b(imageView));
        }
    }
}
